<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="酒店预订">
<meta name="keywords" content="酒店预订,酒店查询,宾馆住宿预订,网上订酒店,手机订酒店">
<title>{$system['m_name']}</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-title" content="酒店预订">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no" name="format-detection">
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/css/fonta/iconfont.css">
<link href="__ROOT__/Public/css/css.css" rel="stylesheet">
<style type="text/css">
    .dl_div0{text-align: center;font-size: 30px;color: #333;line-height: 150px;}
    .dl_div1{border:1px solid #a6b2be;height: 40px;width: 84%;border-radius: 30px;margin:0 auto 10px;}
    .dl_d1_img1{width: 16px;float: left; margin:12px 8px 0 12px;}
    .dl_d1_input1{border:none;background: rgba(0,0,0,0);height: 40px;font-size: 14px;width: 84%;}
    .dl_d1_input2{border:none;background: rgba(0,0,0,0);height: 40px;font-size: 14px;width: 50%;}
    .dl_d1_p1{font-size: 14px;color: #1aa1f3;float: right;line-height: 40px;padding-right: 12px;}
    .dl_p1{color: #647686;height: 34px;float: right;margin-right: 10%;line-height: 34px;}
    .dl_div2{width: 84%;margin: 10px auto;background: -webkit-linear-gradient(left, #1aa1f3, #6783fb);background: -o-linear-gradient(left, #1aa1f3, #6783fb);background: -moz-linear-gradient(left, #1aa1f3, #6783fb);background: linear-gradient(to right, #1aa1f3, #6783fb);height: 40px;line-height: 40px;text-align: center;color: #fff;border-radius: 30px;}
    .dl_div3{width: 100%;line-height: 50px;text-align: center;color: #a6b2be;margin-top: 30px;}
    .dl_div4{width: 100%;text-align: center;}
    .dl_div4_img1{display: inline-block;border-radius: 100%;width: 44px;}
</style>
</head>
<body style="background:#fdfdfe;">
    <div class="dl_div0"><?php if(empty($system['m_name'])){echo '注册';}else{echo $system['m_name'];}?></div>
    
     <div class="dl_div1" style="margin-bottom:20px;">
        <img src="__ROOT__/Public/images/zhanghao.png" class="dl_d1_img1">
        <input class="dl_d1_input1" type="text" id="nickname" placeholder="请输入用户名" autocomplete="off" >
    </div>
    
    <div class="dl_div1" style="margin-bottom:20px;">
        <img src="__ROOT__/Public/images/shouji.png" class="dl_d1_img1">
        <input class="dl_d1_input1" type="text" id="mobile" placeholder="请输入手机号" autocomplete="off" >
    </div>
   
    <div class="dl_div1" style="margin-bottom:20px;">
        <img src="__ROOT__/Public/images/yanzhengma.png" class="dl_d1_img1">
        <input class="dl_d1_input2" type="text" id="code" placeholder="请输入验证码" autocomplete="off" >
        <p class="dl_d1_p1" id="getcode">获取验证码</p>
    </div>

    <!--<div class="dl_div1" style="margin-bottom:20px;">
        <img src="__ROOT__/Public/images/mima.png" class="dl_d1_img1">
        <input class="dl_d1_input1" type="password" id="password" placeholder="请输入密码" autocomplete="off" >
    </div>
    <div class="dl_div1">
        <img src="__ROOT__/Public/images/mima1.png" class="dl_d1_img1">
        <input class="dl_d1_input1" type="password" id="repassword" placeholder="请输入确认密码" autocomplete="off" >
    </div>-->
    <p class="dl_p1" onclick="javascript:location.href='{:U('Home/Mobile/Login/login',array('jsxcode'=>$jsxcode))}'">已有账号</p>
    <div class="clear"></div>
    <div class="dl_div2" id="register">注册</div>
    <!-- 提示 -->
	<div class="zhezhao_boxc">
	    <div class="opentcc"><p id="tips_content"></p></div>
	</div>
	<!-- 加载 -->
	<div class="zhezhao_boxa">
	    <div class="opentca"><img src="__ROOT__/Public/images/loading2.gif"></div>
	</div>
<script language="javascript" src="__ROOT__/Public/js/jquery.js"></script>  
<script>
	
	$("#getcode").on("click",function(){
    	sendCode(this);
    });
    var code_send = 1;   
    var clock = '';
	var nums = 60;
	var btn;
	function sendCode(thisBtn) {
		var pattern = /^1\d{10}$/;
		var phone = $("#mobile").val();
		if(phone==''){
			$('#tips_content').html('请输入手机号！');
			$('.zhezhao_boxc').show();
			setTimeout(function(){
				$('.zhezhao_boxc').hide();
			},1500); 
			return false;
		}else{
			if(!pattern.test($.trim(phone))){
				$('#tips_content').html('请输入有效的手机号码！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500); 
				return false; 
			}
		}		  
		$.ajax({
			type: 'POST',
			url: "{:U('Home/Mobile/Login/sendsms',array('flag'=>'register'))}",
			data: {'phone':phone},
			dataType: 'text',
			success: function(datas){
				if(datas=='1'){
					$('#tips_content').html('验证码发送成功！');
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500);
					btn = thisBtn;
					$(btn).off("click");
					btn.innerHTML = nums+'秒后重新获取';
					clock = setInterval(doLoop, 1000);
				}else{
					$('#tips_content').html(datas);
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500);
					return false; 
				}
			}	
		}); 
	}
	
	function doLoop() {
		nums--;
		if(nums > 0){
			btn.innerHTML = nums+'秒后重新获取'; 
		}else{
			clearInterval(clock); 
			$(btn).on("click",function(){
		    	sendCode(this);
		   });
			btn.innerHTML = '获取验证码';
			nums = 60; 
		}
	}
		
	$('#register').click(function(){		
		var pattern = /^1\d{10}$/;
		var pas_pattern = /^[0-9a-zA-Z]{6,12}$/;
		var phone = $("#mobile").val();
		var code = $("#code").val();	
		var psd = $("#password").val();
		var repsd = $("#repassword").val();
		var nickname = $("#nickname").val();
		
		if(phone==''){
			$('#tips_content').html('请输入用户名！');
			$('.zhezhao_boxc').show();
			setTimeout(function(){
				$('.zhezhao_boxc').hide();
			},1500);
			return false;
		}
		
		if(phone==''){
			$('#tips_content').html('请输入手机号！');
			$('.zhezhao_boxc').show();
			setTimeout(function(){
				$('.zhezhao_boxc').hide();
			},1500);
			return false;
		}else{
			if(!pattern.test($.trim(phone))){
				$('#tips_content').html('请输入有效的手机号码！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500);
				return false; 
			}
		}
		
		if(code_send == '1'){
			if(code==''){
				$('#tips_content').html('请输入验证码！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500);
				return false;
			}
		}
	
	    $('.zhezhao_boxa').show();
		$.ajax({
			type: 'POST',
			url: "{:U('Home/Mobile/Login/doregister',array('jsxcode'=>$jsxcode))}",
			data:{'phone':phone,'code':code,'nickname':nickname,'code_send':code_send},
			dataType: 'text',
			success: function(datas){
				$('.zhezhao_boxa').hide();	
				if(datas =='1'){
					$('#tips_content').html('注册成功');
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
						window.location.href="{:U('Home/Mobile/Login/login',array('jsxcode'=>$jsxcode))}";
					},1500);
				}else if(datas =='2'){
					$('#tips_content').html('注册失败');
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500);
				}else{
					$('#tips_content').html(datas);
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500);
				}
				return false;
			}	
		});
		
	}) 
</script>
</body>
</html>